home *** CD-ROM | disk | FTP | other *** search
/ Adobe Digital Video Collection / Digital Video Collection CD.iso / After Effects 5.5 / EnglishHelp.Cab / F117400_help.js < prev    next >
Encoding:
Text File  |  2001-12-07  |  30.5 KB  |  966 lines

  1. <!--[CDATA[
  2.  
  3. var upperAsciiXlatTbl = new Array(
  4. 223,"ss",
  5. 230,"ae",
  6. 198,"ae",
  7. 156,"oe",
  8. 140,"oe",
  9. 240,"eth",
  10. 208,"eth",
  11. 141,"y",
  12. 159,"y"
  13. );
  14.  
  15. var maxNumberOfShownSearchHits = 100;
  16. var showInputStringAlerts = 0;
  17. var navigationCookie = "";
  18.  
  19. /////////////////////////////// COOKIE-RELATED FUNCTIONS ////////////////////////
  20. // Bill Dortch getCookieVal and GetCookie routines
  21. function getCookieVal(offset) {
  22.   var endstr=document.cookie.indexOf(";",offset);
  23.   if (endstr==-1)endstr=document.cookie.length;
  24.   return unescape(document.cookie.substring(offset, endstr));
  25. }
  26. function GetCookie(name) {
  27.   var arg=name+"=";
  28.   var alen=arg.length;
  29.   var clen=document.cookie.length;
  30.   var i=0;
  31.   while(i<clen){
  32.     var j=i+alen;
  33.     if(document.cookie.substring(i,j)==arg)return getCookieVal(j);
  34.     i=document.cookie.indexOf(" ",i)+1;
  35.     if(i==0)break; 
  36.   }
  37.   return null;
  38. }
  39. function getTopCookieVal(offset) {
  40.   var endstr=top.document.cookie.indexOf(";",offset);
  41.   if (endstr==-1)endstr=top.document.cookie.length;
  42.   return unescape(top.document.cookie.substring(offset, endstr));
  43. }
  44. function GetTopCookie(name) {
  45.   var arg=name+"=";
  46.   var alen=arg.length;
  47.   var clen=top.document.cookie.length;
  48.   var i=0;
  49.   while(i<clen){
  50.     var j=i+alen;
  51.     if(top.document.cookie.substring(i,j)==arg)return getTopCookieVal(j);
  52.     i=top.document.cookie.indexOf(" ",i)+1;
  53.     if(i==0)break; 
  54.   }
  55.   return null;
  56. }
  57. // SetCookie
  58. // -----------
  59. // This function is called to set a cookie in the current document.
  60. //  params:
  61. //        n - name of the cookie
  62. //        v - value of the cookie
  63. //        minutes - the duration of the cookie in minutes (that is, how many minutes before it expires)
  64. function SetCookie(n,v,minutes) {
  65.  var Then = new Date();
  66.  Then.setTime(Then.getTime() + minutes * 60 * 1000);
  67.  document.cookie = n + "=" + v + ";expires=" + Then.toGMTString();
  68. }
  69. // getContentCookie
  70. // ----------------
  71. // This function reads the content cookie set by the handleContext funtion.
  72. //
  73. function getContentCookie()
  74. {
  75.     var contentCookie = GetCookie("content");
  76.     top.document.cookie = "content=";
  77.  
  78.     // What does this expression mean?
  79.     // (contentCookie.indexOf("htm") != -1)
  80.     if ( (contentCookie != null) && (contentCookie.indexOf("htm") != -1) ) 
  81.     {
  82.         document.cookie = "content="; // Wipe out the cookie
  83.         top.document.cookie = "histR=" + contentCookie;
  84.         location.replace(contentCookie);
  85.     }            
  86. }
  87. // getNavigationCookie
  88. // -------------------
  89. // This function reads the content cookie set by the handleContext funtion.
  90. //
  91. function getNavigationCookie()
  92. {
  93.     navigationCookie = GetCookie("navigation");
  94.     top.document.cookie = "navigation=";
  95.  
  96.     // What does this expression mean?
  97.     // (navigationCookie.indexOf("htm") != -1)
  98.     if ( (navigationCookie != null) && (navigationCookie.indexOf("htm") != -1) ) 
  99.     {
  100.         document.cookie = "navigation="; // Wipe out the cookie
  101.         top.document.cookie = "histL=" + navigationCookie;
  102.         location.replace(navigationCookie);
  103.     }
  104.                 
  105. }
  106.  
  107. // handleContext
  108. // -------------
  109. // This function is called from content pages. It sets a cookie as soon
  110. // as the page is loaded. If the content page is not in it's proper place
  111. // in the frameset, the frameset will be loaded and the page will be 
  112. // restored using the value in this cookie.
  113. //
  114. function handleContext(which)
  115. {
  116.     var docLocLastNode = lastNodeOf(document.location);
  117.  
  118.     if( top.frames.length ) {
  119.         
  120.         if( which ) {    // This page is supposed to go into the CONTENT frame
  121.             if( docLocLastNode != lastNodeOf(top.frames[1].location) ) {    // ...but it is being loaded elsewhere
  122.                 top.location.replace("help.html");
  123.                 top.document.cookie = "content=" + docLocLastNode;
  124.             }
  125.             else {
  126.                 top.document.cookie = "histR=" + docLocLastNode;
  127.             }
  128.         }
  129.         else {            // This page is supposed to go into the NAVIGATION frame
  130.             if( docLocLastNode != lastNodeOf(top.frames[0].location) ) {    // ...but it is being loaded elsewhere
  131.                 top.location.replace("help.html");
  132.                 top.document.cookie = "navigation=" + lastNodeOf(top.frames[1].history.previous);
  133.             }
  134.             else {
  135.                 top.document.cookie = "histL=" + docLocLastNode;
  136.             }
  137.         }
  138.     }
  139.     else {
  140.         if( which ) {
  141.             top.document.cookie = "navigation=1_0_0_0.html";
  142.             top.document.cookie = "histL=1_0_0_0.html";
  143.             top.document.cookie = "content=" + docLocLastNode;
  144.             top.document.cookie = "histR=" + docLocLastNode;
  145.         }
  146.         else {
  147.             top.document.cookie = "navigation=" + docLocLastNode;
  148.             top.document.cookie = "histL=" + docLocLastNode;
  149.             top.document.cookie = "content=splash.html";
  150.             top.document.cookie = "histR=splash.html";
  151.         }
  152.         top.location.replace("help.html");
  153.     }
  154. }
  155. // lastNodeOf
  156. // ----------
  157. // This function gets passed a URL and returns the last node of same.
  158. function lastNodeOf(e)
  159. {
  160.     var expr = "" + e;
  161.     var pos = expr.lastIndexOf("/");
  162.  
  163.     if( (pos != -1) && (pos+1 != expr.length) ) {
  164.         return expr.substr(pos+1);
  165.     }
  166.     else {
  167.         return expr;
  168.     }
  169. }
  170. // frameBuster
  171. // -----------
  172. // This function is called by the frameset to ensure it's always loaded
  173. // at the top level of the current window.
  174. //
  175. function frameBuster()
  176. {
  177.     var thisLocation = document.location;
  178.     if ( document.location != top.location )
  179.     {
  180.         top.location.replace("help.html");
  181.     }
  182. }
  183.  
  184.  
  185. // SEARCH RELATED.......................................SEARCH RELATED
  186. // SEARCH RELATED.......................................SEARCH RELATED
  187. // SEARCH RELATED.......................................SEARCH RELATED
  188. // SEARCH RELATED.......................................SEARCH RELATED
  189. // SEARCH RELATED.......................................SEARCH RELATED
  190. // SEARCH RELATED.......................................SEARCH RELATED
  191. // SEARCH RELATED.......................................SEARCH RELATED
  192. // SEARCH RELATED.......................................SEARCH RELATED
  193. // SEARCH RELATED.......................................SEARCH RELATED
  194. // SEARCH RELATED.......................................SEARCH RELATED
  195. function bubbleSortWithShadow(a,b)
  196. {
  197.     var temp;
  198.     for(var j=1; j<a.length; j++) {
  199.         for(var i=0; i<j; i++) {
  200.             if( a[i] < a[j] ) {    
  201.                 temp = a[j];a[j] = a[i];a[i] = temp;
  202.                 temp = b[j];b[j] = b[i];b[i] = temp;
  203.             }
  204.         }
  205.     }
  206. }
  207. //---------------------------------------------------
  208. function buildHtmlResultsStr()
  209. {
  210.     var innerHTMLstring,ndxEnd;
  211.  
  212.     // Gather all of the results display lines into the 'resultsArr'
  213.         ndxEnd = (matchesArrIndices.length > maxNumberOfShownSearchHits ) ? maxNumberOfShownSearchHits : matchesArrIndices.length;
  214.  
  215.         for(var ndx=0, resultsArr = new Array(); ndx < ndxEnd; ndx++) {
  216.             resultsArr[resultsArr.length] = buildResultsStrOneLine(matchesArrIndices[ndx],matchesArrHits[ndx]);
  217.         }
  218.  
  219.     // Convert this 'resultsArr' into a single string that will be injected into this search page.
  220.         innerHTMLstring = "<p>\n";
  221.         for( var ndx=0; ndx < resultsArr.length; ndx++ ) {
  222.             innerHTMLstring = innerHTMLstring + resultsArr[ndx] + "<br />\n";
  223.         }
  224.     return innerHTMLstring;
  225. }
  226. //---------------------------------------------------
  227. function buildResultsStrOneLine(a,b)
  228. {
  229.     var retStr;
  230.     retStr = "<a href=\"" + top.fileArr[a] + ".html\"";
  231.  
  232.     // for debug...
  233.     //retStr += "target=\"content\" ";
  234.     //retStr += "title=\"" + top.fileArr[a] + ".html-";
  235.     //retStr += a + "-" + b + "\">";
  236.  
  237.     // for production...
  238.     retStr += "target=\"content\" >";
  239.  
  240.     retStr += top.titleArr[a] + "</a>";
  241.     return retStr;
  242. }
  243. //---------------------------------------------------
  244. // checkForHits
  245. //  Break up the search term into words.
  246. //  Check each of those words against...
  247. //        (a) cached titles and 
  248. //        (b) cached content lines 
  249. //  Perform the hit detection for each one, 
  250. //  storing the results into (hits-ordered) 
  251. //        'matchesArrIndices' and 
  252. //        'matchesArrHits'.
  253. //---------------------------------------------------
  254. function checkForHits()
  255. {
  256.     var inputWords = new Array();
  257.     var tempArr = new Array();
  258.  
  259.     // Split the search term into individual search words
  260.         tempArr = searchTerm.split(" ");
  261.         for(var ndx=0; ndx < tempArr.length; ndx++) {
  262.             if( tempArr[ndx].length ) {
  263.                 inputWords[inputWords.length] = tempArr[ndx];
  264.             }
  265.         }
  266.  
  267.     // Initialization
  268.         matchesArrHits = new Array();
  269.         matchesArrIndices = new Array();
  270.  
  271.     // Initialize the 'maskArr' and the 'hitsArr'
  272.         maskArr = new Array();
  273.         hitsArr = new Array();
  274.         for( var ndx = 0; ndx < top.fileArr.length; ndx++ ) {maskArr
  275.             maskArr[maskArr.length] = 1;
  276.             hitsArr[hitsArr.length] = 0;
  277.         }
  278.  
  279.     // Do checking for matches on EACH OF THE INPUT WORDS
  280.         for( var ndx = 0; ndx < inputWords.length; ndx++ ) {
  281.  
  282.             // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  283.             if( ! checkForHitsWordAgainstPages( inputWords[ndx] ) ) {
  284.                 return;     // No sense in continuing, match has failed.
  285.             }
  286.             // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  287.  
  288.             for( var ndx2 = 0; ndx2 < hitsArr.length; ndx2++ ) {
  289.                 if( hitsArr[ndx2] == 0 ) {
  290.                     maskArr[ndx2] = 0;
  291.                 }
  292.                 else {
  293.                     if( maskArr[ndx2] != 0 ) {
  294.                         maskArr[ndx2] += hitsArr[ndx2];
  295.                     }
  296.                 }
  297.             }
  298.         }
  299.  
  300.     // From the final 'maskArr', generate 'matchesArrHits' and 'matchesArrIndices'    
  301.         for( var ndx = 0; ndx < maskArr.length; ndx++ ) {
  302.             if( maskArr[ndx] ) {
  303.                 matchesArrHits[matchesArrHits.length] = maskArr[ndx];
  304.                 matchesArrIndices[matchesArrIndices.length] = ndx;
  305.             }
  306.         }
  307.  
  308.     // If there were any hits, then sort them by highest hits first
  309.         if( matchesArrIndices.length ) {
  310.             bubbleSortWithShadow(matchesArrHits, matchesArrIndices);
  311.         }
  312. }
  313. //---------------------------------------------------
  314. function checkForHitsWordAgainstPages(w)        
  315. {
  316.     var hitAnywhere = 0;
  317.  
  318.     // Process each of the content lines (one per file/page)
  319.         for(var ndx=0; ndx < top.sc2.length; ndx++) {
  320.  
  321.             // Put the cached title into glob_title
  322.                 glob_title = top.sc1[ndx];
  323.  
  324.             // Put the cached content line into glob_phrase
  325.                 glob_phrase = top.sc2[ndx];
  326.                 
  327.             if( maskArr[ndx] ) {
  328.             // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  329.                 if( top.isDblByte ) {
  330.                     hitsArr[ndx] = checkForHitsWordAgainstTitleAndLine2(w,ndx);
  331.                 }
  332.                 else {
  333.                     hitsArr[ndx] = checkForHitsWordAgainstTitleAndLine(w,ndx);
  334.                 }
  335.                 if( hitsArr[ndx] ) {
  336.                     hitAnywhere = 1;
  337.                 }
  338.             // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  339.             }
  340.         }
  341.     return hitAnywhere;
  342. }
  343. //---------------------------------------------------
  344. function checkForHitsWordAgainstTitleAndLine(w, lineNdx)
  345. {
  346.     var words;
  347.     var titleHitCnt = 0;
  348.     var contentHitCnt = 0;
  349.     var regex = new RegExp(w, "i");
  350.  
  351.     // TITLE .........................................
  352.         words = new Array();
  353.         words = glob_title.split(" ");
  354.  
  355.         // EXECUTE TITLE MATCH TEST
  356.         for( var ndx = 0; ndx < words.length; ndx++ ) {
  357.             if( w == words[ndx] ) {
  358.                 titleHitCnt += 100;
  359.                 break;
  360.             }
  361.         }
  362.  
  363.     // CONTENT .........................................
  364.         words = new Array();
  365.         words = glob_phrase.split(" ");
  366.  
  367.         // EXECUTE CONTENT MATCH TEST
  368.         if( regex.test(glob_phrase) ) {    // See if word is anywhere within the phrase first.
  369.             for( var ndx = 0; ndx < words.length; ndx++ ) {
  370.                 if( w == words[ndx] ) {
  371.                     contentHitCnt += getInstanceCount(lineNdx,ndx);
  372.                     break;
  373.                 }
  374.                 else if( w < words[ndx] ) { // If word is greater than the remaining words, leave
  375.                     break;
  376.                 }
  377.             }
  378.         }
  379.  
  380.     return titleHitCnt + contentHitCnt;
  381. }
  382. //---------------------------------------------------
  383. function checkForHitsWordAgainstTitleAndLine2(w, lineNdx)
  384. {
  385.     var titleHitCnt = 0;
  386.     var contentHitCnt = 0;
  387.  
  388.     // TITLE .........................................
  389.         if( glob_title.indexOf(w) != -1 ) {
  390.             titleHitCnt = 100;
  391.         }
  392.  
  393.     // CONTENT .........................................
  394.         contentHitCnt = indexesOf(glob_phrase,w);
  395.  
  396.     return titleHitCnt + contentHitCnt;
  397. }
  398. //---------------------------------------------------
  399. // checkTheInputString
  400. // 
  401. //  returns...
  402. //        empty string - if there is valid input to search
  403. //        message string - if there is NO VALID INPUT to search
  404. //---------------------------------------------------
  405. function checkTheInputString()
  406. {
  407.     var myArr = new Array();
  408.     var tempArr = new Array();
  409.     var foundStopOrShortWord = 0;
  410.     var ptn1 = /\d\D/;
  411.     var ptn2 = /\D\d/;
  412.  
  413.     handleWhitespaceRemoval();
  414.  
  415.     searchTerm = searchTerm.toLowerCase();
  416.  
  417.     searchTerm = filterTheChars(searchTerm);
  418.         
  419.     if( searchTerm.length ) {
  420.         
  421.         // Split the searchTerm
  422.             tempArr = searchTerm.split(" ",100);
  423.             if(showInputStringAlerts){alert( "size of tempArr: " + tempArr.length );}
  424.  
  425.         // Handle periods
  426.             for( var ndx = 0; ndx < tempArr.length; ndx++ ) {
  427.                 if( tempArr[ndx].charCodeAt(0) == 46 ) {    // periods at the start of word
  428.                     //tempArr[ndx] = tempArr[ndx].substr(1); // NOTE: We don't want to do this. (e.g. ".txt")
  429.                 }
  430.                 if( tempArr[ndx].charCodeAt(tempArr[ndx].length-1) == 46 ) { // end of word
  431.                     tempArr[ndx] = tempArr[ndx].substr(0,tempArr[ndx].length-1);
  432.                 }
  433.             }
  434.             
  435.         // Do stopwords and shortwords removal
  436.             for( var ndx = 0; ndx < tempArr.length; ndx++ ) {
  437.                 var word = tempArr[ndx];
  438.                 if(showInputStringAlerts){alert( "Checking word: " + word );}
  439.                 
  440.                 if( ! top.sw[word] ) {
  441.                     if( word.length < 2 ) {
  442.                         foundStopOrShortWord = 1;
  443.                     }
  444.                     else if( (word.length > 2) || (ptn1.test(word) || ptn2.test(word)) ) {
  445.                         myArr[myArr.length] = tempArr[ndx];
  446.                     }
  447.                     else {
  448.                         foundStopOrShortWord = 1;
  449.                     }
  450.                 }
  451.                 else {
  452.                     foundStopOrShortWord = 1;
  453.                 }
  454.             }
  455.  
  456.         // Now reconstruct the searchTerm, based upon the 'myArr'
  457.             searchTerm = "";
  458.             for( var ndx = 0; ndx < myArr.length; ndx++ ) {
  459.                 searchTerm = searchTerm + myArr[ndx] + " ";
  460.             }
  461.  
  462.         handleWhitespaceRemoval();
  463.  
  464.         if(showInputStringAlerts){alert( "FINAL SEARCH TERM: *" + searchTerm + "*" );}
  465.             
  466.         if( foundStopOrShortWord && ! searchTerm.length ) {
  467.             return MSG_stopAndShortWords;
  468.         }
  469.         top.srch_input_massaged = searchTerm;
  470.         return "";
  471.     } 
  472.     else {
  473.         return MSG_noSearchTermEntered;
  474.     }
  475. }
  476. //---------------------------------------------------
  477. function checkTheInputString2()        // double-byte version
  478. {
  479.     var tempArr = new Array();
  480.  
  481.     handleWhitespaceRemoval();
  482.  
  483.     if( searchTerm.length ) {
  484.  
  485.         // Split the searchTerm
  486.             tempArr = searchTerm.split(" ",100);
  487.             if(showInputStringAlerts){alert( "number of search terms: " + tempArr.length );}
  488.  
  489.         // Now reconstruct the searchTerm, based upon the 'tempArr'
  490.             searchTerm = "";
  491.             for( var ndx = 0; ndx < tempArr.length; ndx++ ) {
  492.                 searchTerm = searchTerm + tempArr[ndx] + " ";
  493.             }
  494.             handleWhitespaceRemoval();
  495.  
  496. if(showInputStringAlerts){alert( "Massaged search term: " + searchTerm );}
  497.  
  498.         top.srch_input_massaged = searchTerm;
  499.         return "";
  500.     }
  501.     else {
  502.         return MSG_noSearchTermEntered;
  503.     }
  504. }
  505. //---------------------------------------------------
  506. function dispatch() {
  507.     if ( top.frames.length && is_ie && (top.srch_1_shot || top.srch_message.length) ){
  508.         doIEsearch();
  509.     }
  510. }
  511. //---------------------------------------------------
  512. function doIEsearch()
  513. {
  514.     var stStr = "";
  515.     
  516.     document.forms["search"].input.value = top.srch_input_verbatim;
  517.     
  518.     if( top.srch_message.length ) {
  519.         document.all.results.innerHTML = top.srch_message;
  520.         top.srch_message = "";
  521.     }
  522.     else if( top.srch_1_shot ) {
  523.         top.srch_1_shot = 0;
  524.         
  525.         searchTerm = top.srch_input_massaged;
  526.         checkForHits();    // Sets: 'matchesArrIndices' and 'matchesArrHits'
  527.  
  528.         if( matchesArrIndices.length ) {    // If there were matches/hits...
  529.             stStr = MSG_pagesContaining + top.srch_input_massaged + "<br /><br />\n";
  530.             document.all.results.innerHTML = stStr + buildHtmlResultsStr();
  531.         }
  532.         else {
  533.             document.all.results.innerHTML = MSG_noPagesContain + top.srch_input_massaged;
  534.         }
  535.         searching_message.style.visibility="hidden";
  536.     }
  537.     top.srch_input_verbatim = "";
  538. }
  539. //---------------------------------------------------
  540. function doNNsearch()
  541. {
  542.     if( !top.frames.length || !(is_nav4up || is_gecko || is_opera) ) {return;}
  543.     
  544.     var ndxEnd;
  545.  
  546.     document.forms["search"].input.value = top.srch_input_verbatim; //"";
  547.     
  548.     if( top.srch_message.length ) {
  549.         document.write(top.srch_message);
  550.         top.srch_message = "";
  551.     }
  552.     else if( top.srch_1_shot ) {
  553.         top.srch_1_shot = 0;
  554.                 
  555.         searchTerm = top.srch_input_massaged;
  556.  
  557.         checkForHits();
  558.  
  559.         if( matchesArrIndices.length ) {
  560.  
  561.             document.write(MSG_pagesContaining + top.srch_input_massaged + "<br /><br />\n");
  562.  
  563.             ndxEnd = (matchesArrIndices.length > maxNumberOfShownSearchHits ) ? maxNumberOfShownSearchHits : matchesArrIndices.length;
  564.  
  565.             for(var ndx=0; ndx < ndxEnd; ndx++) {
  566.                 document.write(buildResultsStrOneLine(matchesArrIndices[ndx],matchesArrHits[ndx]) + "<br />\n");
  567.             }    
  568.         }
  569.         else {
  570.             document.write(MSG_noPagesContain + top.srch_input_massaged);
  571.         }
  572.         if (is_nav4) {
  573.             document.layers["searching_message"].visibility="hidden";
  574.         }
  575.     }
  576.     top.srch_input_verbatim = "";
  577.     if (is_nav4) {
  578.         window.stop();
  579.     }
  580. }
  581. //---------------------------------------------------
  582. function getInstanceCount( lineIndex, wordIndex )
  583. {
  584.     var instancesStr = top.instances[lineIndex];    // e.g. "1432931"
  585.     var ch = instancesStr.substr(wordIndex,1);
  586.     
  587.     return parseInt(ch);
  588. }
  589. //---------------------------------------------------
  590. function handleWhitespaceRemoval()
  591. {
  592.     var re_1 = /^\s/;
  593.     var re_2 = /\s$/;
  594.     var re_3 = /\s\s/;
  595.     var temp;
  596.  
  597.     // Remove leading whitespace
  598.         while( true ) {
  599.             temp = searchTerm.replace(re_1,"");
  600.             if( temp == searchTerm ) {
  601.                 break;
  602.             }
  603.             searchTerm = temp;
  604.         }
  605.     // Remove trailing whitespace
  606.         while( true ) {
  607.             temp = searchTerm.replace(re_2,"");
  608.             if( temp == searchTerm ) {
  609.                 break;
  610.             }
  611.             searchTerm = temp;
  612.         }
  613.     // Replace multiple contiguous spaces with a single space
  614.         while( searchTerm.search(re_3) != -1 ) {
  615.             temp = searchTerm.replace(re_3," ");
  616.             searchTerm = temp;
  617.         }
  618. }
  619. //--------------------------------------------------
  620. function isAcceptableChar(chrNdx)
  621. {
  622.     var acceptableChars = new Array( 32, 46, 95 );    // space, period, underscore
  623.     
  624.     for( var ndx = 0; ndx < acceptableChars.length; ndx++ ) {
  625.         if( chrNdx == acceptableChars[ndx] ) {
  626.             return true;
  627.         }
  628.     }
  629.     return false;
  630. }
  631. //--------------------------------------------------
  632. function indexesOf(str,ptn)
  633. {
  634.     var position = 0;
  635.     var hits = -1;
  636.     var start = -1;
  637.  
  638.     while( position != -1 ) {
  639.         position = str.indexOf(ptn, start+1);
  640.         hits += 1;
  641.         start = position;
  642.     }
  643.     return hits;
  644. }
  645. //--------------------------------------------------
  646. function filterTheChars(line)
  647. {
  648.     var retStr = "",tempStr;
  649.     var ch, chCode, retChr;
  650.     var ndx;
  651.     
  652.     for( ndx = 0; ndx < line.length; ndx++ ) {
  653.         ch = line.substr(ndx,1);
  654.         chCode = ch.charCodeAt(0);
  655.         
  656.         
  657.             if( (chCode >= 192) && (chCode <= 221) ) {    // Handle capital upper-ASCII characters
  658.                 chCode = chCode + 32;
  659.                 retChr = ASCII_to_char(chCode);
  660.             }
  661.             else if( withinAcceptableRanges(chCode) || isAcceptableChar(chCode) ) { // Acceptable characters
  662.                 retChr = ch;
  663.             }
  664.             else {
  665.                 tempStr = isLigatureChar(chCode);
  666.  
  667.                 if( tempStr.length ) {    // Handle ligature-style replacements
  668.                     retChr = tempStr;
  669.                 }
  670.                 else {        // Turn all else into space    
  671.                     retChr = " ";
  672.                 }
  673.             }
  674.  
  675.         // Grow the return string
  676.             retStr += retChr;
  677.     }
  678.     
  679.     return retStr;
  680. }
  681. //--------------------------------------------------
  682. function isLigatureChar(codeToCheck) {
  683.     var xlatTblNdx, code, replStr = "";
  684.  
  685.     for( xlatTblNdx = 0; xlatTblNdx < upperAsciiXlatTbl.length; xlatTblNdx+=2 ) {
  686.  
  687.         code = upperAsciiXlatTbl[xlatTblNdx];
  688.         if( code == codeToCheck ) {
  689.             replStr = upperAsciiXlatTbl[xlatTblNdx+1];
  690.             break;
  691.         }
  692.     }
  693.     
  694.     return replStr;
  695. }
  696. //--------------------------------------------------
  697. function respondToSearchButton() 
  698. {
  699.     var myStr;
  700.     
  701.     top.srch_input_verbatim = document.forms["search"].input.value;
  702.     searchTerm = document.forms["search"].input.value;
  703.     
  704.     if( top.isDblByte ) {
  705.         myStr = checkTheInputString2();
  706.     }
  707.     else {
  708.         myStr = checkTheInputString();    
  709.     }
  710.     
  711.     top.srch_message = myStr;
  712.     top.srch_1_shot = top.srch_message.length ? 0 : 1;
  713.     
  714.     if( (! myStr.length) && (! top.didDbLoad) ) {
  715.         document.location = "srch_fset.html";
  716.     }
  717.     else {
  718.         document.location = "search.html";
  719.     }
  720. }
  721. //---------------------------------------------------
  722. function strReplace(orig,src,dest)
  723. {
  724.     var startPos=0;
  725.     var matchPos = orig.indexOf(src,startPos);
  726.     var retLine="";
  727.     
  728.     while(matchPos != -1) {
  729.         retLine = retLine + orig.substring(startPos,matchPos) + dest;
  730.         startPos = matchPos+1;
  731.         matchPos = orig.indexOf(src,startPos);
  732.     }
  733.     if(! retLine.length) {return orig;}
  734.     else {return retLine+orig.substring(startPos,orig.length);}
  735. }
  736. //--------------------------------------------------
  737. function withinAcceptableRanges(chrNdx)
  738. {    
  739.     var acceptableRanges = new Array( "48-57","65-90","97-122","224-229","231-239","241-246","248-253","255-255");
  740.     
  741.     for( var ndx = 0; ndx < acceptableRanges.length; ndx++ ) {
  742.         var start_finish = new Array();
  743.  
  744.         start_finish = acceptableRanges[ndx].split("-");
  745.         
  746.         if( (chrNdx >= start_finish[0]) && (chrNdx <= start_finish[1]) ) {
  747.             return true;
  748.         }
  749.     }
  750.     return false;
  751. }
  752. //--------------------------------------------------
  753. function ASCII_to_char(num_in)
  754. {
  755.     var str_out = "";
  756.     var num_out = parseInt(num_in);
  757.     
  758.     num_out = unescape('%' + num_out.toString(16));
  759.     str_out += num_out;
  760.     
  761.     return unescape(str_out);
  762. }
  763.  
  764. // Ultimate client-side JavaScript client sniff. Version 3.02
  765. // (C) Netscape Communications 1999-2001.  Permission granted to reuse and distribute.
  766. // Revised 17 May 99 to add is_nav5up and is_ie5up (see below).
  767. // Revised 20 Dec 00 to add is_gecko and change is_nav5up to is_nav6up
  768. //                      also added support for IE5.5 Opera4&5 HotJava3 AOLTV
  769. // Revised 22 Feb 01 to correct Javascript Detection for IE 5.x, Opera 4, 
  770. //                      correct Opera 5 detection
  771. //                      add support for winME and win2k
  772. //                      synch with browser-type-oo.js
  773. // Revised 26 Mar 01 to correct Opera detection
  774.  
  775. // Everything you always wanted to know about your JavaScript client
  776. // but were afraid to ask. Creates "is_" variables indicating:
  777. // (1) browser vendor:
  778. //     is_nav, is_ie, is_opera, is_hotjava, is_webtv, is_TVNavigator, is_AOLTV
  779. // (2) browser version number:
  780. //     is_major (integer indicating major version number: 2, 3, 4 ...)
  781. //     is_minor (float   indicating full  version number: 2.02, 3.01, 4.04 ...)
  782. // (3) browser vendor AND major version number
  783. //     is_nav2, is_nav3, is_nav4, is_nav4up, is_nav6, is_nav6up, is_gecko, is_ie3,
  784. //     is_ie4, is_ie4up, is_ie5, is_ie5up, is_ie5_5, is_ie5_5up, is_hotjava3, is_hotjava3up,
  785. //     is_opera2, is_opera3, is_opera4, is_opera5, is_opera5up
  786. // (4) JavaScript version number:
  787. //     is_js (float indicating full JavaScript version number: 1, 1.1, 1.2 ...)
  788. // (5) OS platform and version:
  789. //     is_win, is_win16, is_win32, is_win31, is_win95, is_winnt, is_win98, is_winme, is_win2k
  790. //     is_os2
  791. //     is_mac, is_mac68k, is_macppc
  792. //     is_unix
  793. //     is_sun, is_sun4, is_sun5, is_suni86
  794. //     is_irix, is_irix5, is_irix6
  795. //     is_hpux, is_hpux9, is_hpux10
  796. //     is_aix, is_aix1, is_aix2, is_aix3, is_aix4
  797. //     is_linux, is_sco, is_unixware, is_mpras, is_reliant
  798. //     is_dec, is_sinix, is_freebsd, is_bsd
  799. //     is_vms
  800. //
  801. // See http://www.it97.de/JavaScript/JS_tutorial/bstat/navobj.html and
  802. // http://www.it97.de/JavaScript/JS_tutorial/bstat/Browseraol.html
  803. // for detailed lists of userAgent strings.
  804. //
  805. // Note: you don't want your Nav4 or IE4 code to "turn off" or
  806. // stop working when new versions of browsers are released, so
  807. // in conditional code forks, use is_ie5up ("IE 5.0 or greater") 
  808. // is_opera5up ("Opera 5.0 or greater") instead of is_ie5 or is_opera5
  809. // to check version in code which you want to work on future
  810. // versions.
  811.  
  812.     // convert all characters to lowercase to simplify testing
  813.     var agt=navigator.userAgent.toLowerCase();
  814.  
  815.     // *** BROWSER VERSION ***
  816.     // Note: On IE5, these return 4, so use is_ie5up to detect IE5.
  817.     var is_major = parseInt(navigator.appVersion);
  818.     var is_minor = parseFloat(navigator.appVersion);
  819.  
  820.     // Note: Opera and WebTV spoof Navigator.  We do strict client detection.
  821.     // If you want to allow spoofing, take out the tests for opera and webtv.
  822.     var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
  823.                 && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
  824.                 && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
  825.     var is_nav2 = (is_nav && (is_major == 2));
  826.     var is_nav3 = (is_nav && (is_major == 3));
  827.     var is_nav4 = (is_nav && (is_major == 4));
  828.     var is_nav4up = (is_nav && (is_major >= 4));
  829.     var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||
  830.                           (agt.indexOf("; nav") != -1)) );
  831.     var is_nav6 = (is_nav && (is_major == 5));
  832.     var is_nav6up = (is_nav && (is_major >= 5));
  833.     var is_gecko = (agt.indexOf('gecko') != -1);
  834.  
  835.  
  836.     var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
  837.     var is_ie3    = (is_ie && (is_major < 4));
  838.     var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5")==-1) );
  839.     var is_ie4up  = (is_ie && (is_major >= 4));
  840.     var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
  841.     var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
  842.     var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
  843.     var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
  844.  
  845.     // KNOWN BUG: On AOL4, returns false if IE3 is embedded browser
  846.     // or if this is the first browser window opened.  Thus the
  847.     // variables is_aol, is_aol3, and is_aol4 aren't 100% reliable.
  848.     var is_aol   = (agt.indexOf("aol") != -1);
  849.     var is_aol3  = (is_aol && is_ie3);
  850.     var is_aol4  = (is_aol && is_ie4);
  851.     var is_aol5  = (agt.indexOf("aol 5") != -1);
  852.     var is_aol6  = (agt.indexOf("aol 6") != -1);
  853.  
  854.     var is_opera = (agt.indexOf("opera") != -1);
  855.     var is_opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
  856.     var is_opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
  857.     var is_opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
  858.     var is_opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
  859.     var is_opera5up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4);
  860.  
  861.     var is_webtv = (agt.indexOf("webtv") != -1); 
  862.  
  863.     var is_TVNavigator = ((agt.indexOf("navio") != -1) || (agt.indexOf("navio_aoltv") != -1)); 
  864.     var is_AOLTV = is_TVNavigator;
  865.  
  866.     var is_hotjava = (agt.indexOf("hotjava") != -1);
  867.     var is_hotjava3 = (is_hotjava && (is_major == 3));
  868.     var is_hotjava3up = (is_hotjava && (is_major >= 3));
  869.  
  870.     // *** JAVASCRIPT VERSION CHECK ***
  871.     var is_js;
  872.     if (is_nav2 || is_ie3) is_js = 1.0;
  873.     else if (is_nav3) is_js = 1.1;
  874.     else if (is_opera5up) is_js = 1.3;
  875.     else if (is_opera) is_js = 1.1;
  876.     else if ((is_nav4 && (is_minor <= 4.05)) || is_ie4) is_js = 1.2;
  877.     else if ((is_nav4 && (is_minor > 4.05)) || is_ie5) is_js = 1.3;
  878.     else if (is_hotjava3up) is_js = 1.4;
  879.     else if (is_nav6 || is_gecko) is_js = 1.5;
  880.     // NOTE: In the future, update this code when newer versions of JS
  881.     // are released. For now, we try to provide some upward compatibility
  882.     // so that future versions of Nav and IE will show they are at
  883.     // *least* JS 1.x capable. Always check for JS version compatibility
  884.     // with > or >=.
  885.     else if (is_nav6up) is_js = 1.5;
  886.     // NOTE: ie5up on mac is 1.4
  887.     else if (is_ie5up) is_js = 1.3
  888.  
  889.     // HACK: no idea for other browsers; always check for JS version with > or >=
  890.     else is_js = 0.0;
  891.  
  892.     // *** PLATFORM ***
  893.     var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
  894.     // NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all
  895.     //        Win32, so you can't distinguish between Win95 and WinNT.
  896.     var is_win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));
  897.  
  898.     // is this a 16 bit compiled version?
  899.     var is_win16 = ((agt.indexOf("win16")!=-1) || 
  900.                (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) || 
  901.                (agt.indexOf("windows 16-bit")!=-1) );  
  902.  
  903.     var is_win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) ||
  904.                     (agt.indexOf("windows 16-bit")!=-1));
  905.  
  906.     var is_winme = ((agt.indexOf("win 9x 4.90")!=-1));
  907.     var is_win2k = ((agt.indexOf("windows nt 5.0")!=-1));
  908.  
  909.     // NOTE: Reliable detection of Win98 may not be possible. It appears that:
  910.     //       - On Nav 4.x and before you'll get plain "Windows" in userAgent.
  911.     //       - On Mercury client, the 32-bit version will return "Win98", but
  912.     //         the 16-bit version running on Win98 will still return "Win95".
  913.     var is_win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1));
  914.     var is_winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1));
  915.     var is_win32 = (is_win95 || is_winnt || is_win98 || 
  916.                     ((is_major >= 4) && (navigator.platform == "Win32")) ||
  917.                     (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1));
  918.  
  919.     var is_os2   = ((agt.indexOf("os/2")!=-1) || 
  920.                     (navigator.appVersion.indexOf("OS/2")!=-1) ||   
  921.                     (agt.indexOf("ibm-webexplorer")!=-1));
  922.  
  923.     var is_mac    = (agt.indexOf("mac")!=-1);
  924.     // hack ie5 js version for mac
  925.     if (is_mac && is_ie5up) is_js = 1.4;
  926.     var is_mac68k = (is_mac && ((agt.indexOf("68k")!=-1) || 
  927.                                (agt.indexOf("68000")!=-1)));
  928.     var is_macppc = (is_mac && ((agt.indexOf("ppc")!=-1) || 
  929.                                 (agt.indexOf("powerpc")!=-1)));
  930.  
  931.     var is_sun   = (agt.indexOf("sunos")!=-1);
  932.     var is_sun4  = (agt.indexOf("sunos 4")!=-1);
  933.     var is_sun5  = (agt.indexOf("sunos 5")!=-1);
  934.     var is_suni86= (is_sun && (agt.indexOf("i86")!=-1));
  935.     var is_irix  = (agt.indexOf("irix") !=-1);    // SGI
  936.     var is_irix5 = (agt.indexOf("irix 5") !=-1);
  937.     var is_irix6 = ((agt.indexOf("irix 6") !=-1) || (agt.indexOf("irix6") !=-1));
  938.     var is_hpux  = (agt.indexOf("hp-ux")!=-1);
  939.     var is_hpux9 = (is_hpux && (agt.indexOf("09.")!=-1));
  940.     var is_hpux10= (is_hpux && (agt.indexOf("10.")!=-1));
  941.     var is_aix   = (agt.indexOf("aix") !=-1);      // IBM
  942.     var is_aix1  = (agt.indexOf("aix 1") !=-1);    
  943.     var is_aix2  = (agt.indexOf("aix 2") !=-1);    
  944.     var is_aix3  = (agt.indexOf("aix 3") !=-1);    
  945.     var is_aix4  = (agt.indexOf("aix 4") !=-1);    
  946.     var is_linux = (agt.indexOf("inux")!=-1);
  947.     var is_sco   = (agt.indexOf("sco")!=-1) || (agt.indexOf("unix_sv")!=-1);
  948.     var is_unixware = (agt.indexOf("unix_system_v")!=-1); 
  949.     var is_mpras    = (agt.indexOf("ncr")!=-1); 
  950.     var is_reliant  = (agt.indexOf("reliantunix")!=-1);
  951.     var is_dec   = ((agt.indexOf("dec")!=-1) || (agt.indexOf("osf1")!=-1) || 
  952.            (agt.indexOf("dec_alpha")!=-1) || (agt.indexOf("alphaserver")!=-1) || 
  953.            (agt.indexOf("ultrix")!=-1) || (agt.indexOf("alphastation")!=-1)); 
  954.     var is_sinix = (agt.indexOf("sinix")!=-1);
  955.     var is_freebsd = (agt.indexOf("freebsd")!=-1);
  956.     var is_bsd = (agt.indexOf("bsd")!=-1);
  957.     var is_unix  = ((agt.indexOf("x11")!=-1) || is_sun || is_irix || is_hpux || 
  958.                  is_sco ||is_unixware || is_mpras || is_reliant || 
  959.                  is_dec || is_sinix || is_aix || is_linux || is_bsd || is_freebsd);
  960.  
  961.     var is_vms   = ((agt.indexOf("vax")!=-1) || (agt.indexOf("openvms")!=-1));
  962. // End: Ultimate client-side JavaScript client sniff. Version 3.02
  963.  
  964.  
  965. // ]]-->
  966.